package cn.hxzy.teacher.mapper;


import cn.hxzy.common.domain.Direction;
import cn.hxzy.common.domain.SysSubject;
import cn.hxzy.common.domain.SysSubjectLabel;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author tyhxzy
 * @since 2024-12-14
 */
public interface SysSubjectLabelMapper {
    //    查询所有标签类别
    @Select("select * from sys_subject_label,sys_direction where major_id=direction_id ")
    List<SysSubjectLabel> selectAllLabel();
    //    删除
    @Delete("delete from sys_subject_label where label_id=#{id};")
    int deleteByID(Integer id);
    @Select("select * from sys_subject where subject_label=#{id}")
    List<SysSubject> selectByID(Integer id);

    //    修改标签
    @Update("update sys_subject_label set label_name=#{labelName},major_id=#{majorId} where label_id=#{labelId}")
    int updateLabel(SysSubjectLabel sysSubjectLabel);

    // 新增标签
    @Insert("insert into sys_subject_label(label_name,major_id) values(#{labelName},#{majorId})")
    int insertLabel(SysSubjectLabel sysSubjectLabel);
//    若强行删除标签，则将标签下的所有科目的标签置为null
//    @Update("update  sys_subject set subject_label=null where subject_label=#{id}")
//    void updateSubjectLabel(Integer id);
////    根据专业名称进行模糊查询
//    @Select("select * from sys_subject_label,sys_direction where label_name like concat('%',#{majorName},'%') and major_id=direction_id")
//    List<SysSubjectLabel> selectByMajorName(String majorName);

    //    删除
    @Delete("delete from sys_subject_label where label_id=#{id};")
    int deleteByID(int id);


    @Select("select * from sys_subject_label")
    List<SysSubjectLabel> selectquanbu();

}
